package com.weiaibenpao.demo.chislim.presenter;

import com.weiaibenpao.demo.chislim.base.BasePresenter;
import com.weiaibenpao.demo.chislim.bean.MedalBean;
import com.weiaibenpao.demo.chislim.retrofit.RetrofitUtils;
import com.weiaibenpao.demo.chislim.retrofit.rx.NetWorkTransformer;
import com.weiaibenpao.demo.chislim.retrofit.rx.SimpleObserver;
import com.weiaibenpao.demo.chislim.view.MedalView;

/**
 * Created by wlx on 2017/12/13.
 */

public class MedalPresenter extends BasePresenter<MedalView> {
    public void getMedal(int userId){
        RetrofitUtils.getAPIService().getUserMedal(userId).
                compose(new NetWorkTransformer<MedalBean>()).
                subscribe(new SimpleObserver<MedalBean>(mCompositeDisposable) {
                    @Override
                    public void call(MedalBean medalBean) {
                        getView().medalSuccess(medalBean);
                    }

                });
    }
}
